#ifndef __PNG_DECODER_H__
#define __PNG_DECODER_H__

#include "./basedecoder.h"
#include "libpng/png.h"

namespace MiniUI
{

class PngDecoder : public BaseDecoder
{
public:
    PngDecoder(BaseIOStub* iostub);
    ~PngDecoder();
    virtual bool ReadImageInfo(DecodeFormat* deco);
    virtual bool ReadImageFrame(DecodeFormat* deco);
    virtual bool FinishDecode(DecodeFormat* deco);
public:
    static bool CheckFormat(const byte* pbuf, int nbuflen);
    static void PNGAPI png_read_mem(png_structp png_ptr, png_bytep data, png_size_t length);
protected:
    png_structp m_png_ptr;
    png_infop m_info_ptr;
    int m_nPass;
};

}

#endif